<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8" isELIgnored="false"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<base href="<%=basePath %>" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<!-- BOOTSTRAP STYLES-->
<link href="css/bootstrap.css" rel="stylesheet" />
<!-- FONTAWESOME STYLES-->
<link href="css/font-awesome.css" rel="stylesheet" />
<!--CUSTOM BASIC STYLES-->
<link href="css/basic.css" rel="stylesheet" />
<!--CUSTOM MAIN STYLES-->
<link href="assets/css/custom.css" rel="stylesheet" />
<!-- GOOGLE FONTS-->
<link href='http://fonts.useso.com/css?family=Open+Sans'
	rel='stylesheet' type='text/css' />
	 <script src="http://code.jquery.com/jquery-1.11.0-beta1.js"></script>
<title></title>
<script type="text/javascript">
			function dianji() {

				var flag = document.getElementById("all").checked;
	     		var cks = document.getElementsByName("ck");

				if(flag) {

					for(var i = 0; i < cks.length; i++) {

						cks[i].checked = true;

					}

				} else {

					for(var i = 0; i < cks.length; i++) {

						cks[i].checked = false;

					}

				}

			}
		</script>
</head>
<body>
	<script type="text/javascript">
	$(function(){
		$('input.delOrder').click(function(){
			var value=$(this).parent('td').parent('tr').find('td').eq(1).html();
			if (confirm("是否删除？")) {
				window.location.href="orderDele.do?Oid="+value; 
			} else {
				alert("删除失败！");
			}

		})
		})
	</script>
	<script type="text/javascript">
	$(function(){
		$('input.OrderMessage').click(function(){
			var value=$(this).parent('td').parent('tr').find('td').eq(1).html();
			window.location.href="orderMessage.do?Oid="+value; 
		})
		})
	</script>
	<script type="text/javascript">
	$(function(){
		$('input.edit').click(function(){
			var value=$(this).parent('td').parent('tr').find('td').eq(1).html();
			window.location.href="orderEdit.do?Oid="+value; 
		})
		})
	</script>
	
	<div class="container-fluid">
		<div class="row">
			<div class="col-md-12">
				<h1 class="page-header">
					订单管理 <small> 订单列表</small>
				</h1>
			</div>
		</div>
		<div class="row">
			<div class=" col-md-12 ">
				<!-- 商品列表--bootstrap高级表格使用 -->
				<div class="panel panel-default">
					<div class="panel-heading">订单列表</div>
					<div class="panel-body">
						<!--table-responsive响应式表格，会自动添加滚动条-->
						<form action="orderAll.do">
							<div class="">

								<select id="OSid" name="OSid">
									<option value="">--订单状态--</option>
									<c:forEach items="${orderState }" var="orderState">
										<option value="${orderState.OSid }">${orderState.OSname }</option>
									</c:forEach>
								</select> &nbsp;&nbsp;&nbsp;&nbsp; 订单编号：<input id="oid" name="oid"
									type="text" />&nbsp;&nbsp;&nbsp;&nbsp; <input type="submit"
									value="搜索" />
							</div>
						</form>
						<br />

						<div class="table-responsive">
							<table class="table table-striped table-bordered table-hover"
								id="order_manage">
								<thead>
									<tr>
										<th><input type="checkbox" name="checkall" id="all"
											onchange="dianji()"></input></th>
										<th>订单编号</th>
										<th>买家姓名</th>
										<th>订单金额(元)</th>
										<th>订单状态</th>
										<th>下单日期</th>
										<th>操作</th>
									</tr>
								</thead>
								<tbody>
									<c:forEach items="${orderManage}" var="orderManage">
										<tr>
											<td><input type="checkbox" name="ck"
												onclick='doCheckOne(this)'></input></td>
											<td name='Oid'>${orderManage.oid}</td>
											<td name='c_name'>${orderManage.c_name}</td>
											<td name='Oamount'>${orderManage.oamount}</td>
											<td name='OSname'>${orderManage.OSname}</td>
											<td name='SOtime'>${orderManage.SOdate} ${orderManage.SOtime}</td>
											<td><input type="button" name="OrderMessage" value="详情"
												class="OrderMessage" style="border: 0px" /> &nbsp;&nbsp; <input
												type="button" name="edit" value="修改" class="edit"
												style="border: 0px" />&nbsp;&nbsp; <input type="button"
												name="delOrder" value="删除" class="delOrder" style="border: 0px" />
											</td>
										</tr>
									</c:forEach>
								</tbody>
							</table>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>

</body>
</html>